<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateUserDoctorsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('st_user_doctors', function (Blueprint $table) {
            $table->increments('id');
            $table->string('name');
            $table->unsignedTinyInteger('sex')->default(0)->comment('性别 0男1女');
            $table->string('phone', 20)->unique()->comment('手机号');
            $table->unsignedInteger('hospital_id')->comment('所属医院');
            $table->unsignedMediumInteger('department')->comment('医生科室');
            $table->string('password');
            $table->integer('province')->comment('省份');
            $table->integer('city')->comment('城市');
            $table->integer('county')->comment('区县');
            $table->integer('nation')->comment('民族');
            $table->date('birthday')->comment('出生日期');
            $table->boolean('show_mobile')->default(0)->comment('是否在手机端显示');
            $table->string('invite_code')->comment('邀请码');
            $table->string('invite_original_code')->comment('被邀请码, 邀请人的邀请码');
            $table->unsignedTinyInteger('invite_type')->comment('邀请类型 1医生邀请 2好友邀请');
            $table->timestamp('last_login')->comment('最后登录时间');
            $table->unsignedTinyInteger('admin')->default(0)->comment('是否管理员 0否1是');
            $table->string('account',20)->comment('原表中的account,为了请求数据，以及环信的账号使用');
            $table->rememberToken();
            $table->softDeletes();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('st_user_doctors');
    }
}
